package main

import (
	"os"

	"gopkg.in/yaml.v3"
)

// Config 定义了从 YAML 加载的配置结构
type Config struct {
	Zabbix struct {
		URL      string `yaml:"url"`
		Username string `yaml:"username"`
		Password string `yaml:"password"`
	} `yaml:"zabbix"`
}

const (
	zabbixAPIVersion = "2.0"
	contentType      = "application/json-rpc"
)

func loadConfig(path string) (*Config, error) {
	data, err := os.ReadFile(path)
	if err != nil {
		return nil, err
	}

	var config Config
	err = yaml.Unmarshal(data, &config)
	if err != nil {
		return nil, err
	}

	return &config, nil
}
